<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>展示数据</title>
    <script src="https://cdn.bootcdn.net/ajax/libs/vue/2.6.9/vue.common.dev.js"></script>
    <script src="https://unpkg.com/element-ui/lib/index.js"></script>
    <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
</head>
<style>
</style>

<body>
    <div id="app" style="max-width: 700px;margin: 0 auto;">

        <div style="width: 75%;margin: 0 auto;margin-top: 40%;">
            <div style="margin: 30px auto;width: 150px;">
                <el-radio v-model="type" label="0">QQ</el-radio>
                <el-radio v-model="type" label="1">其他</el-radio>
            </div>
            <el-input type="textarea" :rows="5" placeholder="请输入内容" v-model="textarea">
            </el-input>
        </div>
        <div style="width: 75%;margin: 0 auto; text-align: center;margin-top: 10%;">
            <el-button type="primary" style="width: 100%;" @click="onClickFun">一键下号</el-button>
        </div>

    </div>
</body>
<script>
    new Vue({
        el: '#app',
        data() {
            return {
                textarea: "",
                type: "0"
            }
        },
        methods: {
            onClickFun() {
                let contact = []
                if (this.type == "0") {
                    const reg = new RegExp(/[0-9]{5,10}/g)
                    contact = this.textarea.match(reg);
                } else {
                    contact = this.textarea.split(/\s/);
                }

                if (!this.textarea) return alert("内容不能为空")
                fetch(`/web/deleteContactxz`, {
                    method: 'POST',
                    headers: {
                        'Content-Type': 'application/json'
                    },
                    body: JSON.stringify({
                        pass: "6688",
                        contact
                    })
                }).then(response => response.json()).then(json => {
                    alert(json.message)
                    this.textarea = ''
                })

            }
        },
    })
</script>
<style>

</style>

</html>